﻿using System.Collections.Generic;
using System.Data.Entity.Core.Mapping;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Infrastructure;
using System.Reflection;
using System.Threading.Tasks;
using Sharp.Domain.PlatformBoundedContext.PermissionModule.Events;
using Sharp.Domain.PlatformBoundedContext.UserModule.Events;
using Sharp.Events;
using Sharp.Infrastructure.Interfaces;

namespace Sharp.Domain.PlatformBoundedContext
{
    public class Bootstraper : IBootstrapPlugin
    {
        public Assembly[] StartupAssembles { get; set; }
        public int Order { get; set; }

        public void Initialize()
        {
            //using (Entities dbContext = new Entities())
            //{
            //    var objectContext = ((IObjectContextAdapter)dbContext).ObjectContext;

            //    var mappingCollection =
            //        (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
            //    mappingCollection.GenerateViews(new List<EdmSchemaError>());
            //}
        }

        public Task InitializeAsync()
        {
            return Task.Run(() =>
            {

                

                this.IsAlready = true;
            });
        }

        public bool IsAlready { get; set; }
    }
}